[PATCH] Fix crash in pdfseparate
authorSune Vuorela <sune@vuorela.dk>
Tue, 29 Jul 2025 12:14:00 +0000 (14:14 +0200)
committerJeremy Bícha <jbicha@ubuntu.com>
Sun, 31 Aug 2025 18:01:36 +0000 (14:01 -0400)
Don't continue recursing in PDFDoc::mark* if things looks a bit weirder
than expected

Gbp-Pq: Name CVE-2025-50420.patch

poppler/PDFDoc.cc

index f0dae9be7f56c92f2e82112eb85a5529dea64f46..7294d2c6927b8bc9b19091ea31255b499d98f494 100644 (file)
@@ -1857,6 +1857,15 @@ bool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, unsi
             if (obj1.isDict()) {
                 Dict *dict = obj1.getDict();
                 Object type = dict->lookup("Type");
+                if (type.isNull()) {
+                    Object subType = dict->lookup("SubType");
+                    // Type is optional, subtype is required
+                    // If neither of them exists, something is probably
+                    // weird here, so let us just skip this entry
+                    if (subType.isNull()) {
+                        continue;
+                    }
+                }
                 if (type.isName() && strcmp(type.getName(), "Annot") == 0) {
                     const Object &obj2 = dict->lookupNF("P");
                     if (obj2.isRef()) {